<?php
require($_SERVER['DOCUMENT_ROOT'].'/admin/public/header.php');

$link =@mysql_connect('127.0.0.1','root','root');
if(!$link){
    die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "select * from `column` order by id asc;";
$res=mysql_query($sql) or mysql_error();

$arr=array();
    while($row=mysql_fetch_assoc($res)){
        $arr[]=$row;
    }
    
mysql_free_result($res);
mysql_close();
?>
    <!--/sidebar-->
 <div class="main-wrap">
        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="/admin/index.php ">首页</a>
            <span class="crumb-step">&gt;</span><span class="crumb-name">作品管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="/admin/index.php" method="post">
                    <table class="search-tab">
                        <tr>
                            <th width="120">选择分类:</th>
                            <td>
                                <select name="search-sort" id="">
                                    <option value="">全部</option>
                                    <option value="19">精品界面</option><option value="20">推荐界面</option>
                                </select>
                            </td>
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="/admin/column/add.php"><i class="icon-font"></i>新增作品</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>ID</th>
                            <th>栏目名称</th>
                            <th>栏目描述</th>  
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        <?php
                        foreach($arr as $v){
                            echo '<tr>
                                    <td>'.$v['id'].'</td>
                                    <td>'.$v['cname'].'</td>
                                    <td>'.$v['describe'].'</td>
                                    <td>'.($v['status']?'显示':'不显示').'</td>
                                    <td>'.date($v['datetime']).'</td>
                                    <td>
                                        <a class="link-update" href="/admin/column/update.php?id='.$v['id'].'">修改</a>
                                        <a class="link-del" href="/admin/column/del.php?id='.$v['id'].'">删除</a>
                                    </td>
                                </tr>'; 
                        }
                        ?>
                    </table>
                    <div class="list-page"> 2 条 1/1 页</div>
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
<?php
require($_SERVER['DOCUMENT_ROOT'].'/admin/public/footer.php');
?> 